package com.newspublish.system.controller;

import com.newspublish.system.entity.system.ImpeachNews;
import com.newspublish.system.service.ImpeachNewsService;
import com.newspublish.system.utils.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/impeach")
@Api(tags = "举报违规新闻接口")
public class ImpeachNewsController {

    @Autowired
    private ImpeachNewsService impeachNewsService;

    @ApiOperation(value="提交举报内容")
    @PostMapping("/impeachNews")
    public Result impeachNews(ImpeachNews impeachNews){
        return impeachNewsService.impeachNews(impeachNews);
    }

    @ApiOperation(value="获取举报信息(待处理)")
    @GetMapping("selectImpeachNews/{id}")
    public Result selectImpeachNews(){
        return impeachNewsService.selectImpeachNews();
    }

    @ApiOperation(value="根据id获取举报信息")
    @GetMapping("selectImpeachNewsById/{id}")
    public Result selectImpeachNewsById(@PathVariable("id") Integer id){
        return impeachNewsService.selectImpeachNewsById(id);
    }

    @ApiOperation(value="审核违规新闻")
    @PutMapping("/auditor")
    public Result auditor(ImpeachNews impeachNews){
        return impeachNewsService.auditor(impeachNews);
    }

    @ApiOperation(value="根据举报人获取举报信息")
    @PutMapping("/getByWhistleblower")
    public Result getByWhistleblower(){
        return impeachNewsService.getByWhistleblower();
    }

}
